<?php 
/**
 * Elgg secondary sidebar contents
 *
 * You can override, extend, or pass content to it
 *
 * @uses $vars['sidebar_alt] HTML content for the alternate sidebar
 */

/**SCORE**/

$golf_scores = elgg_view('golfscore/sidebar');
echo $golf_scores;

/*MEMBER  - FRIEND*/
$owner = elgg_get_page_owner_entity();
$view_type = ($owner->type=='user'? 'owner' : 'all');

$newest_members = elgg_list_entities_from_metadata(array(
		'metadata_names' => 'icontime',
		'type' => 'user',
		'limit' => 10,
		'full_view' => false,
		'pagination' => false,
		'list_type' => 'gallery',
		'gallery_class' => 'elgg-gallery-users',
		'size' => 'small',
));
$options = array(
		'relationship' => 'friend',
		'relationship_guid' => $owner->getGUID(),
		'type' => 'user',
		'full_view' => FALSE,
		'count' => TRUE,
		'inverse_relationship' => FALSE,
		'limit' => 12,
		'list_class' => "elgg-gallery-friends",
		'size' => "small",
		'pagination' => true,
		'class' => 'elgg-friend-gallery'
);
$content = elgg_list_entities_from_relationship($options);

if(!$content){
	$content = elgg_echo('friend:none');
}
if($view_type == 'all') {
	echo elgg_view_module('featured',  elgg_echo("custom:members"), $newest_members,'' );
}else{
	echo elgg_view_module('featured',  elgg_echo("friend:owner",array($owner->name)), $content,'' );
}

//LATEST NEWS

if (elgg_is_active_plugin('igolf_news')) {
	echo elgg_view('sidebar_news');
}
/*  if(elgg_is_active_plugin('igolf_news')){
	//echo elgg_view_module("featured", elgg_echo("Lastest News"),$vars['igolf_news']);
 	$object = elgg_get_plugin_from_id('igolf_news');
	echo elgg_view('igolf_news',$vars);
	//$widget = #
}else{
	echo elgg_view('page/elements/get_igolf_news', $vars);
}  */


